package com.wanxin.wb.module.weixin.controller;

import java.util.ArrayList;
import java.util.List;




import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wanxin.wb.common.support.BaseController;
import com.wanxin.wb.module.weixin.vo.JSONTestVO;

@Controller
@RequestMapping("/weixin/cn/json")
public class JsonController  extends BaseController{
	
	/**
	 * localhost:8080/UPI/weixin/cn/json/test.do
	 */
	
	     @RequestMapping(value = "/testPost", produces = "application/json; charset=utf-8", method = RequestMethod.POST)
	    @ResponseBody
	  
	    public String testPost(@RequestParam(value = "data", required = true) String data) {
	      
	        /*------------------------------------------------------------------*
	         *                              准备参数
	         *------------------------------------------------------------------*/
	             
	        /*------------------------------------------------------------------*
	         *                              返回结果
	         *------------------------------------------------------------------*/
	        List<JSONTestVO>  list=new ArrayList<>();
	        JSONTestVO vo=new JSONTestVO();
	        vo.setId(System.currentTimeMillis()+"");
	        vo.setId("JSON Test");
	        list.add(vo);
	       // String response=JSONObject.toJSONString(list);
	        return success(list);
	    }
	     
	     
	     @RequestMapping(value = "/testGet", produces = "application/json; charset=utf-8", method = RequestMethod.GET)
		    @ResponseBody
		  
		    public String testGet(@RequestParam(value = "data", required = true) String data) {
		      
		        /*------------------------------------------------------------------*
		         *                              准备参数
		         *------------------------------------------------------------------*/
		             
		        /*------------------------------------------------------------------*
		         *                              返回结果
		         *------------------------------------------------------------------*/
		        List<JSONTestVO>  list=new ArrayList<>();
		        JSONTestVO vo=new JSONTestVO();
		        vo.setId(System.currentTimeMillis()+"");
		        vo.setId("JSON Test");
		        list.add(vo);
		       // String response=JSONObject.toJSONString(list);
		        return success(list);
		    }
	    

}
